package com.liy.cloud.common.base.service.impl;


import com.liy.cloud.common.base.dao.BaseGoodsPropertyDao;
import com.liy.cloud.common.base.entity.BaseGoodsPropertyEntity;
import com.liy.cloud.common.base.service.BaseGoodsPropertyService;
import com.das.framework.common.dao.IBaseDao;
import com.das.framework.common.service.impl.BaseServiceImpl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class BaseGoodsPropertyServiceImpl extends BaseServiceImpl<BaseGoodsPropertyEntity, String> implements BaseGoodsPropertyService {

	@Autowired
	private BaseGoodsPropertyDao goodsPropertyDao;

	@Override
	public IBaseDao<BaseGoodsPropertyEntity, String> getDao() {
		return goodsPropertyDao;
	}


    @Override
    public void deleteBatch(List<String> ids) {
        for( String id : ids ){
			goodsPropertyDao.deleteByPrimaryKey(id);
        }
    }

    @Override
    public List<BaseGoodsPropertyEntity> getAccountArrByIds(List<String> ids) {
        List<BaseGoodsPropertyEntity>  entityList = new ArrayList();
	    for( String id : ids ){
            BaseGoodsPropertyEntity entity = goodsPropertyDao.selectByPrimaryKey(id);
            entityList.add(entity);
        }
        return entityList;
    }

    @Override
    public int addGoodsProperty(BaseGoodsPropertyEntity baseGoodsPropertyEntity) throws Exception {

        return this.add(baseGoodsPropertyEntity);
    }

    /**
     * @Author:  liyang
     * @Date:    2018/8/29  9:07
     * @Description:  按 type大类 和 typeExs小类查询 必传此2字段
     *
     **/
    @Override
    public List<BaseGoodsPropertyEntity> selectByTypeAndTypeExs(BaseGoodsPropertyEntity entity) {
        return goodsPropertyDao.selectByTypeAndTypeExs(entity);
    }

}
